package xx.iverson.enums;


import lombok.Getter;
import xx.iverson.result.ReturnResult;

/**
 * xx.iverson.enums.EnumException
 * 描述：常用枚举异常
 * on 2025/6/26-下午5:17
 *
 * @author weijx
 */

@Getter
public enum EnumException {
    USER_NOT_EXIST(10001, "用户不存在"),
    USER_PASSWORD_ERROR(10002, "用户名或密码错误"),
    USER_NOT_LOGIN(10003, "用户未登录或鉴权失效"),
    USER_LOGIN_ERROR(10004, "用户登录失败"),
    USER_LOGOUT_ERROR(10005, "用户登出失败"),
    USER_REGISTER_ERROR(10006, "用户注册失败"),
    USER_REGISTER_USER_EXIST(10006, "用户注册失败，用户名已存在"),
    USER_UPDATE_ERROR(10007, "用户更新失败"),
    USER_NOT_AUTH(10008, "用户未提供鉴权信息"),
    USER_GET_ERROR_IP(99999, "获取ip失败或ip格式错误"),
    USER_GET_ERROR_ADDRESS(99998, "获取地址失败"),
    USER_GET_ERROR_WEATHER(99997, "获取天气失败"),
    ;
    private final int errorCode;

    private final String errorMsg;


    EnumException(int errorCode, String errorMsg) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public ReturnResult<?> toResult() {
        return ReturnResult.error(this.errorCode, this.errorMsg, null);
    }

}
